<?php
class classePadrao
{
	function executarQuery($query = "")
	{
		if ($query)
			$this->query = $query;

		$validarInstrucao = mysql_query($this->query);

		return $validarInstrucao;
	}

	function fetchInArray($query = "")
	{
		if ($query)
			$this->query = $query;
		
		$rc = $this->executarQuery();

		$dados = array();

		if ($rc)
		{
			$total = mysql_num_rows($rc);
			$totalCampos = mysql_num_fields($rc);

			for ($i=0; $i<$total; $i++)
			{
				for ($j=0; $j<$totalCampos; $j++)
				{
					$infoCampo = mysql_fetch_field($rc, $j);
					$dados[$i][$infoCampo->name] = mysql_result($rc, $i, $infoCampo->name);
				}
			}
		}

		return $dados;
	}
	
	function lastDBerror()
	{
		return mysql_error();
	}

	function lastId()
	{
		return mysql_insert_id();
	}
}
?>
